package cn.html.jie;

import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;

import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Bili {
    public static void main(String[] args) {
        try {
            Map<String,Integer> map=new HashMap<>();
            Document document = Jsoup.connect("https://www.bilibili.com/").get();
            Elements element = document.getAllElements();
            for (Element e : element) {
                String s = e.toString();
                String s1 = Arrays.stream(Arrays.stream(s.trim().split(" ")).findFirst().get().trim().split(">")).findFirst().get();
                if (map.get(s1)==null){
                    map.put(s1,1);
                }else {
                    Integer integer = map.get(s1);
                    map.put(s1,integer+1);
                }
            }
            System.out.println(map.keySet());


        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
